Skip to content

Conversation

@camchenry
Copy link
Member

@camchenry camchenry commented Sep 22, 2025

This is an initial pass at supporting rule configurations in headless mode. We currently do not pass any options along from oxlint, but this allows passing an options field in the headless payload with each rule which will get serialized and pass along to the rule. We will need to be careful about how we handle the configs and validate the input coming in. However, this should be a backwards compatible change since it only adds a new field to the existing payload.

This uses go-jsonschema to generate the JSON deserialization code from a JSON Schema file, which makes adding or updating the supported options very easy. This reduces a lot of the maintenance for us and should make it quick to add support for configuration to all of the existing rules. To go along with that, there is a new CI workflow that validates the generated schema code matches what we expect (needs to be regenerated for any changes).

For now, only the no-floating-promises rule is implemented, as it has some non-trivial options configuration. Most other rules should be simpler than this one.

Copy link
Member Author

camchenry commented Sep 22, 2025


How to use the Graphite Merge Queue

Add the label 0-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@camchenry camchenry force-pushed the 09-21-feat_add_support_for_headless_rule_config branch 2 times, most recently from a943347 to 083a2ae Compare September 22, 2025 04:22
@camchenry
Copy link
Member Author

@camc314 I'd appreciate your early thoughts on this direction. I'd love to find a way to avoid rewriting every rule to be compatible with accepting JSON input.

@camchenry
Copy link
Member Author

Sorry @auvred I should have pinged you too last night! You're much more familiar with Go than I am, so perhaps there is a more idiomatic way of handling this. With the current approach, we would need to manually (or have AI) write a function for every rule that allows accepting any and checks if it's a map of some kind, or an exact match for the rule options. Would be a decent chunk of work, but if it's necessary, then I guess that's what we need to do. 🤷

@auvred
Copy link
Collaborator

auvred commented Sep 24, 2025

As stated in #51 (comment), the main issue is that Go structs don't allow expressing typescript-eslint options one-to-one. If I were doing this, I'd write (or try to find) a Go code generator that takes typescript-eslint meta.schema (JSON Schema) and generates a small, interface-based typed deserializer for each rule.

@osdiab
Copy link

osdiab commented Oct 18, 2025

Is there any update on progress towards the go struct/typescript-eslint option mapping? don't want to be pushy, just really looking forward to this so we can give it a spin! Thanks!

@camchenry
Copy link
Member Author

@osdiab I've been busy with other things, but I am actively working on this again, so I hope to have it usable in oxlint in the next month or so.

@camchenry camchenry force-pushed the 09-21-feat_add_support_for_headless_rule_config branch 7 times, most recently from 5591d21 to bcd476e Compare November 5, 2025 01:05
@camchenry camchenry mentioned this pull request Nov 5, 2025
@camchenry camchenry force-pushed the 09-21-feat_add_support_for_headless_rule_config branch 2 times, most recently from d80a2b4 to 3344a06 Compare November 8, 2025 02:50
@camchenry camchenry marked this pull request as ready for review November 8, 2025 02:52
@camchenry camchenry requested a review from camc314 November 8, 2025 02:52
Copy link
Member Author

camchenry commented Nov 11, 2025

Merge activity

- Towards #51

This is an initial pass at supporting rule configurations in headless mode. We currently do not pass any options along from `oxlint`, but this allows passing an `options` field in the headless payload with each rule which will get serialized and pass along to the rule. We will need to be careful about how we handle the configs and validate the input coming in. However, this should be a backwards compatible change since it only adds a new field to the existing payload.

This uses `go-jsonschema` to generate the JSON deserialization code from a JSON Schema file, which makes adding or updating the supported options very easy. This reduces a lot of the maintenance for us and should make it quick to add support for configuration to all of the existing rules. To go along with that, there is a new CI workflow that validates the generated schema code matches what we expect (needs to be regenerated for any changes).

For now, only the `no-floating-promises` rule is implemented, as it has some non-trivial options configuration. Most other rules should be simpler than this one.
@graphite-app graphite-app bot force-pushed the 09-21-feat_add_support_for_headless_rule_config branch from 3344a06 to 8d8e029 Compare November 11, 2025 02:57
@graphite-app graphite-app bot merged commit 8d8e029 into main Nov 11, 2025
7 checks passed
@graphite-app graphite-app bot deleted the 09-21-feat_add_support_for_headless_rule_config branch November 11, 2025 03:14
@graphite-app graphite-app bot removed the 0-merge label Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants